package com.weixing.mall.provider.controller.front;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.weixing.mall.base.wrapper.Result;
import com.weixing.mall.base.wrapper.ResultUtil;
import com.weixing.mall.core.annotation.NoNeedAccess;
import com.weixing.mall.base.enums.WhetherEnum;
import com.weixing.mall.core.support.BaseController;
import com.weixing.mall.provider.model.domain.SubSite;
import com.weixing.mall.provider.service.ISubSiteService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 支付设置 前端控制器
 * </p>
 *
 * @author Small
 * @since 2020-01-08
 */
@RestController
@RequestMapping("front/subsite")
@Api(value = "前端：子站api", tags = "前端：子站")
public class FrontSubSiteController extends BaseController {

    @Autowired
    private ISubSiteService subSiteService;

    @ApiOperation(value = "子站列表")
    @GetMapping("")
    @NoNeedAccess
    public Result<List<SubSite>> channelList() {
        QueryWrapper<SubSite> wrapper = new QueryWrapper<>();
        wrapper.eq("is_enable", WhetherEnum.YES.getValue()).orderByAsc("order_by");
        List<SubSite> list = subSiteService.list(wrapper);
        return ResultUtil.success(list);
    }
}
